<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>React Antd 01</title>
    <script src="https://cdn.bootcss.com/react/16.2.0/umd/react.development.js"></script>
    <script src="https://cdn.bootcss.com/react-dom/16.2.0/umd/react-dom.development.js"></script>

    <script src="https://cdn.bootcss.com/react-router/4.2.0/react-router.js"></script>
    <script src="https://cdn.bootcss.com/react-router-dom/4.2.2/react-router-dom.js"></script>

    <script src="https://cdn.bootcss.com/prop-types/15.6.0/prop-types.min.js"></script>

    <script src="https://cdn.bootcss.com/moment.js/2.19.4/moment.min.js"></script>
    <link href="../javascript/antd/3.0.3/antd.css" rel="stylesheet">
    <script src="../javascript/antd/3.0.3/antd.js"></script>

    <script src="https://cdn.bootcss.com/babel-standalone/6.26.0/babel.min.js"></script>

    <link href="https://cdn.bootcss.com/highlight.js/9.12.0/styles/vs2015.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>

    <script>hljs.initHighlightingOnLoad();</script>
</head>
<body>
<div id="root"></div>

<p>代码</p>
<pre><code class="babel">
</code>
<script type="text/babel">
    const {
        BrowserRouter,
        Route,
        Link
    } = ReactRouterDOM;
    const { Table, Popconfirm, Button } = antd;

    const Router = BrowserRouter;

    const Products = (props) => (
        <h2>List of Products</h2>
    );

    const ProductList = ({ onDelete, products }) => {
        const columns = [{
            title: 'Name',
            dataIndex: 'name',
        }, {
            title: 'Actions',
            render: (text, record) => {
                return (
                    <Popconfirm title="Delete?" onConfirm={() => onDelete(record.id)}>
                        <Button>Delete</Button>
                    </Popconfirm>
                );
            },
        }];
        return (
            <Table
                dataSource={products}
                columns={columns}
            />
        );
    };


    ProductList.propTypes = {
        onDelete: PropTypes.func.isRequired,
        products: PropTypes.array.isRequired,
    };


    const App = ({ dispatch, products }) => {
        function handleDelete(id) {
            dispatch({
                type: 'products/delete',
                payload: id,
            });
        }
        return (
            <div>
                <h2>List of Products</h2>
                <ProductList onDelete={handleDelete} products={products} />
            </div>
        );
    };

    const { Timeline, Icon } = antd;
    ReactDOM.render(
        <Timeline>
            <Timeline.Item>Create a services site 2015-09-01</Timeline.Item>
            <Timeline.Item>Solve initial network problems 2015-09-01</Timeline.Item>
            <Timeline.Item>Technical testing 2015-09-01</Timeline.Item>
            <Timeline.Item dot={<Icon type="clock-circle-o" style={{ fontSize: '16px' }} />} color="red">Technical testing 2015-09-01</Timeline.Item>

            <Timeline.Item>Network problems being solved 2015-09-01</Timeline.Item>
        </Timeline>
        , document.getElementById('root')
    );
</script>

</body>
</html>